<!--
 * @Description: 高级设置
 * @Author: wangwangwang
 * @Date: 2020-07-27 14:43:15
 * @LastEditors: wangwangwang
 * @LastEditTime: 2020-08-20 10:19:38
--> 
<template>
  <section>
    <el-form ref="form" label-position="left" :model="form" label-width="180px" style="width:50%;">
      <el-form-item label="审批人合并规则">
        <el-select v-model="form.mergeRule" placeholder="请选择活动区域" style="width:100%;">
          <el-option label="不启用合并规则" :value="0"></el-option>
          <el-option label="同一审批人在流程出现多次时，仅保留第一个" :value="1"></el-option>
          <el-option label="同一审批人在流程出现多次时，仅保留最后一个" :value="2"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label=" ">
        <el-checkbox v-model="form.autoPass">发起人审批时自动通过</el-checkbox>
      </el-form-item>
      <el-form-item label="审批意见填写提示">
        <el-input v-model="form.suggestion"></el-input>
      </el-form-item>
      <el-form-item label="默认审批意见">
        <el-input v-model="form.defaultSuggestion"></el-input>
      </el-form-item>
      <el-form-item label="手写签名">
        <el-checkbox v-model="form.handlerWrite">同意时必须签名</el-checkbox>
      </el-form-item>
    </el-form>
  </section>
</template>
<script>
import { getAdvanceData } from '@/api/Signed/flows'
export default {
  props: ['processManagerId'],
  data() {
    return {
      form: {
        mergeRule: 0,
        autoPass: false,
        suggestion: '',
        defaultSuggestion: '',
        handlerWrite: '',
      },
    }
  },
  methods: {
    initData() {
      getAdvanceData({ processManagerId: this.processManagerId }).then(res => {
        if (res.code === 1001) {
          if (res.data) { // 存在时为编辑
            this.form = {
              mergeRule: res.data.mergeRule,
              autoPass: res.data.autoPass === 1 ? true : false,
              suggestion: res.data.suggestion,
              id: res.data.id,
              defaultSuggestion: res.data.defaultSuggestion,
              handlerWrite: res.data.handlerWrite === 1 ? true : false,
            }
          }
        }
      })
    }
  },
  mounted() {
    this.initData();
  }
}
</script>
<style scoped>
</style>
